// pages/homepage/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    swiper:["1","2","1","2","1","2","1","2"],
    timerr:"",
    fenmin:"",
    hourmin:"",
    list:[
      {
        "endTime": 0,
				"groupNum": 0,
				"imageList": [],
				"joinUserList": [],
				"name": "",
				"nowTime": 0,
				"pid": 0,
				"price": 0,
				"rewardMoney": 0,
				"startTime": 0,
				"title": ""
      }
    ],
    info:{
      "accountIntegral": 0,
      "accountMoney": 0,
      "booleanAddress": 0,
      "nickName": "",
      "photoUpload": "",
      "userCode": "",
      "userId": 0
    }

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
     var that = this;
     var times = 0
      setInterval(() => {
        times++
        that.setData({
          timerr:  times % 60 < 10 ? ":" + "0" + times % 60: ":" +times % 60,
          fenmin:  Math.floor(times / 60) < 10 ? ":"+"0"+Math.floor(times / 60): ":" + Math.floor(times / 60),
          hourmin: Math.floor(times / 3600) < 10 ? "0" + Math.floor(times / 3600):Math.floor(times / 3600)
        });
      },1000);

      wx.request({
        url: 'http://47.118.62.229:4008/local-mall/applet/activity/activityGoodsList',
        header:{
          "content-type":"application/json",
          "device":"android",
          "token":"eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMiIsImlhdCI6MTYyNDQzMzgxMSwiZXhwIjoxNjI0NDM1NjExfQ.r3xNJ6Ykokb7rQdz-2hEpeVPct7_cTTrtmF73GKLkKc"
        },
        method:"POST",
        data:{
          "groupId":1
        },
        dataType:"json",
        success (res) {
          console.log(res.data)
          that.setData({
            "list":res.data["data"]["list"]
          })
        }
      })
  },



  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    var that = this;
    wx.request({
      url: 'http://47.118.62.229:4008/local-mall/applet/activity/basicUserInfo',
      header:{
        "content-type":"application/json",
        "device":"android",
        "token":"eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiIxMiIsImlhdCI6MTYyNDQzMzgxMSwiZXhwIjoxNjI0NDM1NjExfQ.r3xNJ6Ykokb7rQdz-2hEpeVPct7_cTTrtmF73GKLkKc"
      },
      method:"GET",
      data:{},
      dataType:"json",
      success (res) {
        console.log(res.data)
        that.setData({
          "info":res.data["data"]
        })
      }
    })
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})